Package net.mitza.rel.base

Source Code of net.mitza.rel.base.ExpressionComparator

package net.mitza.rel.base;

import net.mitza.rel.parser.Parser;
import net.mitza.rel.parser.expression.ExpressionNode;

import com.tridion.tcdl.TransformContext;

/**
* @author Mihai Cadariu
*/
public class ExpressionComparator {

  private final TransformContext context;

  public ExpressionComparator(TransformContext context) {
    this.context = context;
  }

  public boolean evaluate(String condition) {
    if (condition == null) {
      return false;
    }

    Parser parser = new Parser(context);
    ExpressionNode expressionNode = parser.parseCondition(condition);
    return expressionNode.getBooleanValue();
  }
}
TOP

Related Classes of net.mitza.rel.base.ExpressionComparator

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.